# coding:utf-8

import math

def prime(n):

    l1 = [2,3]

    for i in range(2,n):
        if(i % 6 == 1 or i % 6 ==5):
            if(i >=25):
                for j in range(5,int(math.sqrt(i))+1,6):
                    if(i % j ==0 or i % (j + 2) == 0):
                        break

                else:
                    l1.append(i)
            else:
                l1.append(i)
        if(len(l1) > 10000):
            print(l1[-1])
            break

def main ():
    n = 1000001
    prime(n)
if __name__ == '__main__':
    main()
